package com.geeguo.ebuilder.client.controller.system.operlog;

import com.geeguo.ebuilder.client.base.tenant.model.DataContext;
import com.geeguo.ebuilder.client.base.tenant.provider.TenantProvider;
import com.geeguo.ebuilder.client.business.system.operlog.model.OperLogQuery;
import com.geeguo.ebuilder.client.business.system.operlog.model.OperLogVO;
import com.geeguo.ebuilder.client.business.system.operlog.service.OperLogService;
import com.geeguo.ebuilder.core.common.action.ActionResult;
import com.geeguo.ebuilder.core.common.model.vo.PageListVO;
import com.geeguo.ebuilder.core.security.annotation.RequiresPermissions;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "操作日志记录管理")
@RestController
public class OperLogController {

    @Autowired
    private OperLogService operLogService;

    @Operation(summary = "分页查询操作日志记录")
    @PostMapping("/system/operLog/list")
    @RequiresPermissions("System:OperLog")
    public ActionResult<PageListVO<OperLogVO>> list(OperLogQuery query) {
        DataContext dataContext = TenantProvider.getDataContext();
        return ActionResult.page(operLogService.list(query, dataContext));
    }
}
